/*************************************************************************
 *
 * $Id: hw.h 128 2007-02-18 20:35:06Z alpov $
 * 
 *************************************************************************/         

#ifndef _HW_H
#define _HW_H

/*****************
 * serial
 *****************/ 
#define SerialSwitchTx()    { PORTD |= _BV(PD2); }
#define SerialSwitchRx()    { PORTD &= ~_BV(PD2); }
#define InitSerialHw()      { DDRD |= _BV(PD2); }


/*****************
 * 1wire
 *****************/ 
#define OWInitHw()          { DDRA |= _BV(PA0) | _BV(PA2); }
#define OWStrongPullup(x)   (x ? (PORTA &= ~_BV(PA2)) : (PORTA |= _BV(PA2)))
#define OWSetLink(x)        (x ? (PORTA &= ~_BV(PA0)) : (PORTA |= _BV(PA0)))
#define OWGetLink()         (PINA & _BV(PA1) ? 1 : 0)


/*****************
 * dataflash
 *****************/ 
#define InitDataflashHw()   { DDRB |= _BV(PB3); }
#define DF_CS_active()      PORTB &= ~_BV(PB3)
#define DF_CS_inactive()    PORTB |= _BV(PB3)


/*****************
 * io
 * jsou deklarovany v io.c 
 *****************/ 


#endif
